<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::any('upload-base64','UploadController@uploadBase64');

Route::prefix('zadmin')->namespace('Admin')->group(function(){
	Route::get('login',     'LoginController@login');
 	Route::any('logindo',   'LoginController@loginDo');
 	Route::middleware('checkAdmin')->group(function(){
		Route::resource('admins',	'AdminController');				
		Route::resource('cate',		'CateController');
		Route::resource('role',		'RoleController');
		Route::resource('banner',	'BannerController');
		Route::resource('type',		'TypeController');
		Route::resource('decorate',		'DecorateController');
		Route::resource('car-brands','CarBrandController');
		Route::resource('car-series','CarSerieController');
		Route::resource('customer-service','CustomerServiceController');
		Route::resource('tensecond','TensecondController');
		Route::get('index',			'IndexController@index');
		Route::get('test',			'IndexController@test');
		Route::resource('menu',		'MenuController');
		Route::get('menu/permission/{id}','MenuController@menuPermission');
		Route::resource('permission',	  'PermissionController');


		Route::prefix('users')->group(function(){
			Route::get('list',		'UserController@index');
			Route::post('update',	'Usercontroller@update');
			Route::get('edit/{user_id}',     	'UserController@edit');
			
			Route::get('address/{user_id}',   'UserController@address');
			
			Route::get('moneylog/{user_id}',  'Usercontroller@moneylog');
			
			Route::post('change-status',      'Usercontroller@changeStatus'); // 停用账号
		});

		

		Route::prefix('shop')->group(function(){
			Route::get('list','ShopController@index');
			Route::get('add', 'ShopController@add');
			Route::post('save','ShopController@save');
			Route::get('edit/{shop_id}',	'ShopController@edit');
			Route::post('update',			'ShopController@update');
			Route::get('frozen/{shop_id}',	'ShopController@frozen');
			
			Route::get('orders/{shop_id}',   'ShopController@orders');		
			Route::get('withdraw/{shop_id}',   'ShopController@address');
			Route::get('envelope/{shop_id}',   'ShopController@envelope');
			Route::get('comment/{shop_id}',    'ShopController@comment');
			Route::get('check','ShopController@check');

			Route::resource('user','ShopUserController');
			
		});

		Route::prefix('product')->group(function(){
			Route::get('point',		  'ProductController@point');
			Route::get('add',		  'ProductController@add');
			Route::post('save',       'ProductController@save');
			Route::post('sale-status','ProductController@saleStatus');
			Route::get('/',           'ProductController@index');
		});

		Route::prefix('partner')->group(function(){
			Route::get('price',		  'PartnerController@price');

			Route::get('price-add',	  'PartnerController@priceAdd');
			Route::get('price-edit',	'PartnerController@priceEdit');
			Route::post('price-save',   'PartnerController@priceSave');
			Route::post('price-update', 'PartnerController@priceUpdate');
			Route::post('check-status', 'PartnerController@checkStatus');
			Route::get('index',         'PartnerController@index');
			Route::get('edit',			'PartnerController@edit');
			Route::post('update',		'PartnerController@update');
			Route::delete('del/{id}',   'PartnerController@destroy');
		});

		Route::prefix('sale')->group(function(){			
			Route::get('add',		  'ProductSaleController@add');
			Route::post('save',       'ProductSaleController@save');
			Route::post('sale-status','ProductSaleController@saleStatus');
			Route::get('/',           'ProductSaleController@index');
		});

		Route::prefix('order')->group(function(){
			Route::get('detail/{order_id}','OrderController@detail');
			Route::post('confirm/{order_id}','OrderController@confirm');
			
			Route::get('/','OrderController@index');
		});

		Route::get('/','IndexController@dashboard');
	});
	

});

Route::prefix('partner')->namespace('Partner')->group(function(){
	Route::get('index',    'IndexController@index');
	Route::get('reg',      'IndexController@reg');
	Route::post('reg-do',   'IndexController@regDo');
	Route::get('reg-info',      'IndexController@regInfo');
	Route::post('info-save','IndexController@infoSave');
	Route::get('pending',   'IndexController@pending');
	Route::get('login',    'IndexController@login');
	Route::get('logout',	'IndexController@logout');
	Route::post('login-do',    'IndexController@loginDo');
	Route::post('login-by-mobile','IndexController@loginByMobile');
	Route::post('upload','IndexController@upload');
	Route::get('forget',    'IndexController@forget');
	Route::post('forget-do','IndexController@forgetDo');
	Route::get('send-sms' ,'IndexController@sendSms');
	Route::middleware('checkPartner')->group(function(){
		Route::get('price',    'IndexController@price');
		Route::get('account',    'IndexController@account');
		Route::post('account-do','IndexController@accountDo');
		Route::get('modify',    'IndexController@modify');
		Route::post('modify-update',  'IndexController@modifyUpdate');		
	});
});
